package juc.juccore.copyonwrite;

import java.util.Arrays;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

public class CopyOnWtrteArrayListDemo {
    public static void main(String[] args) {

        //   ArrayList<String> list = new ArrayList<>(Arrays.asList("1", "2", "3", "4", "5"));
        CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<>(Arrays.asList("1", "2", "3", "4", "5"));
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            System.out.println(next);
        }

    }
}
